//
//  AverageUserViewController.m
//  EasyToTesco
//
//  Created by mc on 16/2/22.
//  Copyright © 2016年 Jack. All rights reserved.
//

//普通用户VC


#import "AverageUserViewController.h"
#import "HeaderFileForEasyToTesco.h"
#import "RecordsOfConsumptionViewController.h"
#import "recorTwoViewController.h"
#import "tryViewController.h"
@interface AverageUserViewController ()<UITableViewDataSource, UITableViewDelegate>

@end

@implementation AverageUserViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
   [self addUserVCUI];
    
    [self addUsertopUI];
    
}
- (void)addUserVCUI {
    
    UITableView *UserTableview = [[UITableView alloc] initWithFrame:CGRectMake(0, HIGHT*0.1, WEITH, HIGHT*0.9)  style:UITableViewStylePlain];
    UserTableview.scrollEnabled = NO;
    UserTableview.dataSource = self;
    UserTableview.delegate = self;
    UserTableview.tableFooterView = [[UIView alloc] init];
    [self.view addSubview:UserTableview];
    
    
}

- (void)addUsertopUI {
    
    UIImageView *image1 = [[UIImageView alloc] initWithFrame:CGRectMake(10, (self.secondView.frame.size.height-20)/2, 20, 20)];
    image1.image = [UIImage imageNamed:@"goback-icon.png"];
    [self.secondView addSubview:image1];
    self.leftBtn.hidden = YES;
    
    UIButton *goBackBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    goBackBtn.frame = CGRectMake(0, 0, self.secondView.frame.size.height, self.secondView.frame.size.height);
    [goBackBtn addTarget:self action:@selector(gobackClick) forControlEvents:UIControlEventTouchUpInside];
    [self.secondView addSubview:goBackBtn];
    
        self.titleLabel.text = @"个人专区";

}
- (void)gobackClick {
    [self dismissViewControllerAnimated:YES completion:nil];
}



#pragma mark -- UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
 
        return 2;
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *identifier = @"UserCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    
   
        if (indexPath.row == 0) {
            cell.textLabel.text = @"积分兑换";
        }else {
            cell.textLabel.text = @"消费记录";
        }
    
    
    
    
    return cell;
}


#pragma mark -- UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    if (indexPath.row == 0) {

        
    }else{

         tryViewController *recover = [[tryViewController alloc ] init];
//           [self.navigationController pushViewController:recover animated:YES];
        [self presentViewController:recover animated:YES completion:^{
            
        }];
    }
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
